decorative banner

Writing expressions for source text


    All expressions produce a result that is a number or an array of numbers--with one exception: expressions written for the Source Text property of a text layer. The result of an expression that links to the Source Text property is interpreted as a JavaScript string. The expression replaces the existing text for the layer, using the style of the first character. You can use the pick whip to retrieve the source text from another text layer; however, only the style of the first character of the destination layer is used.

    For example, to copy the original text from one layer and add it to another layer in all upper case characters, type the following expression:

    text.sourceText + "\r" + text.sourceText.toUpperCase()

    Note: You can use "\r" in a String expression to start a new line of text. For more information on the String object, consult a JavaScript guide.